<template>
  <div></div>
</template>

<script>
import { authorizeCase } from "@/api/case";

export default {
  name: "CaseAuth",
  components: {},
  props: {
    case_id: String,
  },
  data() {
    return {};
  },
  watch: {},
  computed: {},
  methods: {
    authorizeCustomerCase() {
      const params = {
        case_id: this.case_id,
      };
      authorizeCase(params)
        .then((res) => {
          this.$dialog
            .alert({
              title: "授权提示",
              message: res.data.message,
              theme: "round-button",
            })
            .then(() => {
              this.$router.push("/case");
            });
        })
        .catch((error) => {
          if(error.response){
            this.$dialog
            .alert({
              title: "授权提示",
              message: "用户案件授权失败！",
              theme: "round-button",
            })
            .then(() => {
              this.$router.push("/case");
            });
          }
        });
    },
  },
  created() {
    console.log(this.case_id);
    this.authorizeCustomerCase();
  },
  mounted() {},
};
</script>

<style  scoped>
</style>